package com.ruoyi.be.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.collections4.bag.SynchronizedSortedBag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.be.domain.MyMedicalOutpatientdoctorReceiverecord;
import com.ruoyi.be.service.IMyMedicalOutpatientdoctorReceiverecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 住院患者信息Controller
 * 
 * @author ly
 * @date 2022-01-05
 */
@RestController
@RequestMapping("/be/receiverecord")
public class MyMedicalOutpatientdoctorReceiverecordController extends BaseController
{
    @Autowired
    private IMyMedicalOutpatientdoctorReceiverecordService myMedicalOutpatientdoctorReceiverecordService;

    /**
     * 查询住院患者信息列表
     */
    @PreAuthorize("@ss.hasPermi('be:receiverecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(MyMedicalOutpatientdoctorReceiverecord myMedicalOutpatientdoctorReceiverecord)
    {
        System.out.println(myMedicalOutpatientdoctorReceiverecord);
        startPage();
        List<MyMedicalOutpatientdoctorReceiverecord> list = myMedicalOutpatientdoctorReceiverecordService.selectMyMedicalOutpatientdoctorReceiverecordList(myMedicalOutpatientdoctorReceiverecord);
        return getDataTable(list);
    }

    /**
     * 导出住院患者信息列表
     */
    @PreAuthorize("@ss.hasPermi('be:receiverecord:export')")
    @Log(title = "住院患者信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MyMedicalOutpatientdoctorReceiverecord myMedicalOutpatientdoctorReceiverecord)
    {
        List<MyMedicalOutpatientdoctorReceiverecord> list = myMedicalOutpatientdoctorReceiverecordService.selectMyMedicalOutpatientdoctorReceiverecordList(myMedicalOutpatientdoctorReceiverecord);
        ExcelUtil<MyMedicalOutpatientdoctorReceiverecord> util = new ExcelUtil<MyMedicalOutpatientdoctorReceiverecord>(MyMedicalOutpatientdoctorReceiverecord.class);
        util.exportExcel(response, list, "住院患者信息数据");
    }

    /**
     * 获取住院患者信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('be:receiverecord:query')")
    @GetMapping(value = "/{opdoctorreceiverecordid}")
    public AjaxResult getInfo(@PathVariable("opdoctorreceiverecordid") String opdoctorreceiverecordid)
    {
        return AjaxResult.success(myMedicalOutpatientdoctorReceiverecordService.selectMyMedicalOutpatientdoctorReceiverecordByOpdoctorreceiverecordid(opdoctorreceiverecordid));
    }

    /**
     * 新增住院患者信息
     */
    @PreAuthorize("@ss.hasPermi('be:receiverecord:add')")
    @Log(title = "住院患者信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MyMedicalOutpatientdoctorReceiverecord myMedicalOutpatientdoctorReceiverecord)
    {
        return toAjax(myMedicalOutpatientdoctorReceiverecordService.insertMyMedicalOutpatientdoctorReceiverecord(myMedicalOutpatientdoctorReceiverecord));
    }

    /**
     * 修改住院患者信息
     */
    @PreAuthorize("@ss.hasPermi('be:receiverecord:edit')")
    @Log(title = "住院患者信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MyMedicalOutpatientdoctorReceiverecord myMedicalOutpatientdoctorReceiverecord)
    {
        return toAjax(myMedicalOutpatientdoctorReceiverecordService.updateMyMedicalOutpatientdoctorReceiverecord(myMedicalOutpatientdoctorReceiverecord));
    }

    /**
     * 修改住院患者信息
     */
    @PreAuthorize("@ss.hasPermi('be:receiverecord:update')")
    @Log(title = "住院患者信息", businessType = BusinessType.UPDATE)
    @PutMapping(value = "update")
    public AjaxResult update(@RequestBody MyMedicalOutpatientdoctorReceiverecord myMedicalOutpatientdoctorReceiverecord)
    {
        return toAjax(myMedicalOutpatientdoctorReceiverecordService.updateMyMedicalOutpatientdoctorReceiverecordUpdate(myMedicalOutpatientdoctorReceiverecord));
    }

    /**
     * 删除住院患者信息
     */
    @PreAuthorize("@ss.hasPermi('be:receiverecord:remove')")
    @Log(title = "住院患者信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{opdoctorreceiverecordids}")
    public AjaxResult remove(@PathVariable String[] opdoctorreceiverecordids)
    {
        return toAjax(myMedicalOutpatientdoctorReceiverecordService.deleteMyMedicalOutpatientdoctorReceiverecordByOpdoctorreceiverecordids(opdoctorreceiverecordids));
    }
}
